<?php
class gallery_model extends CI_Model{
		public $model;
		function __construct(){
			$this->model='gallery';
		}
		
		/*
		 * 
		 */
		public function get_gallery($cid){
			$query=$this->db->order_by('sort_id','desc')->get_where($this->model,array('audit'=>1,'cid'=>$cid))->result_array();
			if(!empty($query)){
				foreach($query as $k=>$v){
					if(!empty($v['photo'])){
						$query[$k]['img']=$this->db->get_where('upload',array('id'=>$v['photo']))->row_array();
					}
				}
			}
			return $query;
		}
		
		
		
		
		
		
}


